/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Negocio;
//import java.util.regex.Pattern;
/**
 *
 * @author sistemas
 */
public class Entero {
    private int Num;

    public int getNum() {
        return Num;
    }

    public void setNum(int Num) {
        this.Num = Num;
    }
    public boolean par() {
        return Num % 2==0;
        }
 //***********Factorial
    public long  Factorial(){
            try{
                long ac=1;
                for (int i=1;i<=Num;i++){
                    ac=ac*i;
                }
               return ac;
               }
            catch(Exception a){
                return 0;
                
            }
        }
          public boolean Primo() {
              if (Num==1){
                  return false;
              }
              else{
                  for (int i=2;i<=Num;i++){
                      if ((Num%i)==0){
                          if(Num==i){
                              return true;
                          }
                              else{
                              return false;
                             }
                              
                          }
                       }
                      }
              return false;
                  }
          
    public int Invertir(){
        int aux=Num;
        int ac=0;
        while(Num>0){
            int residuo=Num%10;
            ac=ac*10+residuo;
            Num=Num/10;
            
        }
        Num=aux;
        return ac;
    }            
    public boolean Capicua(){
        return Num==this.Invertir();
    }
    
       public int Digito(){
        int aux=Num;
        int ac=0;
        while(Num>0){
            int residuo=Num%10;
           Entero obj2 =new Entero();
            if(obj2.Primo()){
              ac=residuo+ac*10; 
            }
              Num=Num/10;
            }
        Num=aux;
        return ac;
    } 
       
       
public  String Fibonaci() {       
           int n=Num;
           int a = 1, b = 1;
           int  s = 0;
          String cadena = "";
          cadena = "1 1";
          while (s < n)
          {
             s = a + b;
             cadena = cadena+ " "+(s); 
             a = b;
             b = s;
          }
          return cadena;
     }
  
}
